﻿namespace MicroCloud.Systems.Database
{
    public class DictEntryConfiguration : EntityTypeConfigurationBase<DictEntry, Guid>
    {
        /// <summary>
        /// 重写以实现实体类型各个属性的数据库配置
        /// </summary>
        /// <param name="builder">实体类型创建器</param>
        public override void Configuration(EntityTypeBuilder<DictEntry> builder)
        {
            builder.HasIndex(m => new { m.DictId, m.CodeValue }).SetIndex("DictIdCodeValue", true);
            builder.HasOne(a => a.Dict).WithMany(a => a.DictEntrys).HasForeignKey(a => a.DictId).SetForeignKey("DictId", true);

        }

    }
}